package cn.lyq.card.data.model

import android.graphics.Color
import com.razerdp.widget.animatedpieview.data.IPieInfo
import com.razerdp.widget.animatedpieview.data.PieOption


class PosPieInfo(var num: Int, var type: Int) : IPieInfo {

    companion object {
        val blue = Color.parseColor("#1E7AFF")
        val yellow = Color.parseColor("#FA9829")

        fun create(info: PosStatisticsInfo): MutableList<PosPieInfo> {
            val temp = mutableListOf<PosPieInfo>()
            if (info.posActNumber != 0) {
                temp.add(PosPieInfo(info.posActNumber, 0))
            }
            if (info.posNotActNumber != 0) {
                temp.add(PosPieInfo(info.posNotActNumber, 1))
            }
            if (info.posNumber == 0){
                temp.add(PosPieInfo(1, 1))
            }
            return temp
        }
    }

    override fun getValue(): Double = num.toDouble()

    override fun getColor(): Int {
        return if (type == 0) {
            blue
        } else {
            yellow
        }
    }

    override fun getDesc(): String = ""

    override fun getPieOption(): PieOption {
        return PieOption()
    }
}